<template>
  <div class="layout" v-show="flag">
    <!-- <TopNav></TopNav> -->
    <div class="main">
      <nuxt></nuxt>
    </div>
    <Footer></Footer>
  </div>
</template>
<script>
import Vue from 'vue'
import Footer from '@/components/base/footer'
import TopNav from '@/components/base/topNav'

export default {
  name: 'layout',
  // components: {TopNav, Footer},
  components: { Footer},
  data () {
    return {
      dom: null,
      flag: false,
    }
  },
  watch: {
  },
  created() {
    if (process.client) {
      if (this._isMobile()) {
        this.$router.replace("/mobile/");
        sessionStorage.setItem("ifNotFirst", true);
      }else {
        this.flag = true
      }
    }
  },
  methods: {
    _isMobile() {
      let flag = navigator.userAgent.match(
        /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
      );
      return flag;
    },
  }
}
</script>
<style scoped lang='scss'>
.layout{
  font-family: Noto Sans SC;
  font-style: normal;
  font-weight: 400;
  height: 100%;
  width: 1900px;
  // overflow: auto;
  display: flex;
  flex-direction: column;
  margin:0 auto;
  .main{
    flex: 1;
  }
}

</style>
